// Copyright 2022 a.o.smith ALL Rights Reserved
package com.liuxinlong.modules.moc.controller;

import com.liuxinlong.modules.common.controller.response.BaseResp;
import com.liuxinlong.modules.moc.controller.request.QueryMocAnalysisReq;
import com.liuxinlong.modules.moc.service.MocAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * 变更分析控制层
 *
 * @author liuxinlong@hotwater.com.cn
 * @version 1.0.0
 * @since 2022年7月13日
 */
@RestController
@RequestMapping("/moc/analysis")
public class MocAnalysisController {

    @Autowired
    private MocAnalysisService mocAnalysisService;

    /**
     * 查询变更分析数据
     *
     * @param req 请求参数
     * @return 变更分析数据
     */
    @PostMapping("query")
//    @LogAnnotation(value = "数据查询", business = LogBusinessConstants.MOC_ANALYSIS,operateType = LogOperateConstants.OPERATE_QUERY)
    public BaseResp queryMocAnalysis(@RequestBody QueryMocAnalysisReq req) {
        Map<String, Object> queryParam = new HashMap<>();
        queryParam.put("startTime", req.getStartTime());
        queryParam.put("endTime", req.getEndTime());
        Map<String, Object> dataMap = mocAnalysisService.queryMocAnalysis(queryParam);
        BaseResp resp = new BaseResp();
        resp.setDataMap(dataMap);
        resp.setRetMessage("查询变更分析数据成功！");
        return resp;
    }


}
